﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 位置区域管理
/// </summary>
[Route("QHSELocation/[action]")]
[ApiController]
public class QHSELocationController : ControllerBase
{
    private readonly QHSELocationService _locationService;

    public QHSELocationController(QHSELocationService locationService)
    {
        _locationService = locationService;
    }
    /// <summary>
    /// 位置区域列表
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> List()
    {
        List<QHSELocationModel> menus = await _locationService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> List1()
    {
        List<QHSELocationModel> menus = await _locationService.GetAsync();
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 位置区域查询
    /// </summary>
    [HttpGet]
    [CustomAuthorize("hdv_qhse_data")]
    public async Task<AppResult> Page([FromQuery] QHSELocationPageInputModel model)
    {
        PageResultModel<QHSELocationModel> data = await _locationService.GetPageAsync(model);
        return AppResult.Status200OK(data: data);
    }
    [HttpGet]
    [ValidateTimestampAndSignature]
    public async Task<AppResult> Page1([FromQuery] QHSELocationPageInputModel model)
    {
        PageResultModel<QHSELocationModel> data = await _locationService.GetPageAsync(model);
        return AppResult.Status200OK(data: data);
    }
}
